from flask import Flask
import os
from routes.main_routes import main_bp  # 引入main路由
from routes.api_routes import api_bp  # 引入API路由

app = Flask(__name__)


# 注册蓝图
app.register_blueprint(main_bp)
app.register_blueprint(api_bp)


if __name__ == '__main__':
    port = int(os.environ.get('PORT', 5000))
    host = os.environ.get('HOST', '0.0.0.0')
    debug = os.environ.get('DEBUG', 'False').lower() == 'true'
    app.run(host=host, port=port, debug=debug)
